17 CLOS compatibility
Currently, the following functions should behave almost as
expected from CLOS.
defclass
-
All slot keywords are available but not all work correctly.
Slot keyword differences are:
- :reader, and :writer tags
- Create methods that signal errors instead of creating
an unqualified method. You can still create new ones to do
its business.
- :accessor
- This should create an unqualified method to access a
slot, but instead pre-builds a method that gets the slot's
value.
- :type
- Specifier uses the
typep function from the
cl package. See
(cl)Type Predicates. It therefore has the same issues
as that package. Extensions include the ability to provide
object names.
Defclass also supports class options, but does not
currently use values of :metaclass, and
:default-initargs.
make-instance
- Make instance works as expected, however it just uses the
EIEIO instance creator automatically generated when a
new class is created. See Making New
Objects.
defgeneric
- Creates the desired symbol, and accepts all of the expected
arguments except
:around.
defmethod
- Calls defgeneric, and accepts most of the expected
arguments. Only the first argument to the created method may
have a type specifier. To type cast against a class, the class
must exist before defmethod is called. In addition, the
:around tag is not supported.
call-next-method
- Inside a method, calls the next available method up the
inheritance tree for the given object. This is different than
that found in CLOS because in EIEIO this function
accepts replacement arguments. This permits subclasses to
modify arguments as they are passed up the tree. If no
arguments are given, the expected CLOS behavior is
used.
setf
- If the common-lisp subsystem is loaded, the setf parameters
are also loaded so the form
(setf (slot-value object
slot) t) should work.
CLOS supports the describe command, but
EIEIO only provides eieio-describe-class, and
eieio-describe-generic. These functions are adviced
into describe-variable, and
describe-function.
When creating a new class (see Building Classes)
there are several new keywords supported by EIEIO.
In EIEIO tags are in lower case, not mixed case.